package cn.ruleengine.web.function;

import cn.ruleengine.core.annotation.Executor;
import cn.ruleengine.core.annotation.Function;
import lombok.Data;

import java.util.Collection;

/**
 * @author xianrensawang
 * @date 2021/7/14
 */
@Function
public class StrContainsCollectionOne {

    @Executor
    private Boolean contains(StrContain strContain) {
        Collection<String> target = strContain.getTarget();
        String source = strContain.getSource();
        for (String s : target) {
            if (source.contains(s)) {
                return Boolean.TRUE;
            }
        }
        return Boolean.FALSE;
    }


    @Data
    public static class StrContain {

        /**
         * 源
         */
        private String source;
        /**
         * 目标集合
         */
        private Collection<String> target;

    }

}
